package com.qdxwx.web.controller.ajax;

import com.qdxwx.common.json.AjaxResult;
import com.qdxwx.common.utils.TKConvert;
import com.qdxwx.data.service.area.AreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/ajax/area")
public class AjaxAreaController {

    @Autowired
    private AreaService areaService;

    @RequestMapping(value = "/children.json")
    public AjaxResult getChildren(HttpServletRequest request) {
        int pid = TKConvert.toInteger(request.getParameter("pid"));
        return AjaxResult.success(areaService.getChildren(pid));
    }
}
